GSOAP_ROOT=/usr/local/gSOAP
WSNAME0=soap
WSNAME=netbook

CC=gcc
CFLAGS= -lmydata -lpthread -g -DWITH_NONAMESPACES -I$(GSOAP_ROOT)/include 

SERVER_OBJS=$(WSNAME0)C.o $(WSNAME0)Server.o stdsoap2.o

CLIENT_OBJS=$(GSOAP_ROOT)/env/envC.o $(WSNAME0)ClientLib.o stdsoap2.o

ALL_OBJS=$(WSNAME)server.o ${WSNAME}client.o $(WSNAME0)C.o $(WSNAME0)Server.o $(WSNAME0)ClientLib.o

all:server

${WSNAME}.wsdl:${WSNAME}.h
	$(GSOAP_ROOT)/bin/soapcpp2 -c $(GSOAP_ROOT)/import ${WSNAME}.h

stdsoap2.o:$(GSOAP_ROOT)/src/stdsoap2.c
	$(CC) -c $? $(CFLAGS)

$(ALL_OBJS):%.o:%.c
	$(CC) -c $? $(CFLAGS)

server:Makefile ${WSNAME}.wsdl ${WSNAME}server.o $(SERVER_OBJS)
	$(CC) -o ${WSNAME}server ${WSNAME}server.o $(SERVER_OBJS) $(CFLAGS)

client:Makefile ${WSNAME}.wsdl ${WSNAME}client.o $(CLIENT_OBJS) stdsoap2.o
	$(CC) -o ${WSNAME}client ${WSNAME}client.o $(CLIENT_OBJS) $(CFLAGS)  

clean:
	rm -f *.o *.xml *.a *.wsdl *.nsmap $(WSNAME0)H.h $(WSNAME0)C.c $(WSNAME0)Server.c $(WSNAME0)Client.c $(WSNAME0)Stub.* $(WSNAME)$(WSNAME)Proxy.* $(WSNAME)$(WSNAME)Object.* $(WSNAME0)ServerLib.c $(WSNAME0)ClientLib.c $(WSNAME)server ns.xsd $(WSNAME)client
	rm -f cscope.*
